package com.fc.test.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.fc.test.common.base.BaseService;
import com.fc.test.common.support.Convert;
import com.fc.test.mapper.auto.TAbbBmliuyanMapper;
import com.fc.test.model.auto.TAbbBmliuyan;
import com.fc.test.model.auto.TAbbBmliuyanExample;
import com.fc.test.model.custom.Tablepar;
import com.fc.test.util.SnowflakeIdWorker;

/**
 * 便民信息留言Service
* @Title: TAbbBmliuyanService.java 
* @Package com.fc.test.entity 
* @author fuce
* @email 87766867@qq.com
* @date 2019-08-21 16:15:03  
 */
@Service
public class TAbbBmliuyanService implements BaseService<TAbbBmliuyan, TAbbBmliuyanExample>{
	@Autowired
	private TAbbBmliuyanMapper tAbbBmliuyanMapper;

	/**
	 * 分页查询
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	 public PageInfo<TAbbBmliuyan> list(Tablepar tablepar,String name){
	        TAbbBmliuyanExample testExample=new TAbbBmliuyanExample();
	        testExample.setOrderByClause("id ASC");
	        if(name!=null&&!"".equals(name)){
	        	testExample.createCriteria().andUsernameLike("%"+name+"%");
	        }

	        PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
	        List<TAbbBmliuyan> list= tAbbBmliuyanMapper.selectByExample(testExample);
	        PageInfo<TAbbBmliuyan> pageInfo = new PageInfo<TAbbBmliuyan>(list);
	        return  pageInfo;
	 }

	@Override
	public int deleteByPrimaryKey(String ids) {
		List<String> lista=Convert.toListStrArray(ids);
		TAbbBmliuyanExample example=new TAbbBmliuyanExample();
		example.createCriteria().andIdIn(lista);
		return tAbbBmliuyanMapper.deleteByExample(example);
	}


	@Override
	public TAbbBmliuyan selectByPrimaryKey(String id) {

		return tAbbBmliuyanMapper.selectByPrimaryKey(id);
	}


	@Override
	public int updateByPrimaryKeySelective(TAbbBmliuyan record) {
		return tAbbBmliuyanMapper.updateByPrimaryKeySelective(record);
	}

	/**
	 * 添加
	 */
	@Override
	public int insertSelective(TAbbBmliuyan record) {
		//添加雪花主键id
		record.setId(SnowflakeIdWorker.getUUID());
		return tAbbBmliuyanMapper.insertSelective(record);
	}










	@Override
	public int updateByExampleSelective(TAbbBmliuyan record, TAbbBmliuyanExample example) {

		return tAbbBmliuyanMapper.updateByExampleSelective(record, example);
	}


	@Override
	public int updateByExample(TAbbBmliuyan record, TAbbBmliuyanExample example) {

		return tAbbBmliuyanMapper.updateByExample(record, example);
	}

	@Override
	public List<TAbbBmliuyan> selectByExample(TAbbBmliuyanExample example) {

		return tAbbBmliuyanMapper.selectByExample(example);
	}


	@Override
	public long countByExample(TAbbBmliuyanExample example) {

		return tAbbBmliuyanMapper.countByExample(example);
	}


	@Override
	public int deleteByExample(TAbbBmliuyanExample example) {

		return tAbbBmliuyanMapper.deleteByExample(example);
	}



}
